﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BlogEngine.Core.Providers;

namespace BlogEngine.Core
{
    [Serializable]
    public class Book : BusinessBase<Book, Guid>, IComparable<Book>
    {
        #region Constants and Fields

        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        private string author;
        public string Author
        {
            get { return author; }
            set { author = value; }
        }
        private string picture;
        public string Picture
        {
            get { return picture; }
            set { picture = value; }
        }
        private string publishing;
        public string Publishing
        {
            get { return publishing; }
            set { publishing = value; }
        }
        private string status;
        public string Status
        {
            get { return status; }
            set { status = value; }
        }
        private string summary;
        public string Summary
        {
            get { return summary; }
            set { summary = value; }
        }
        private string comment;
        public string Comment
        {
            get { return comment; }
            set { comment = value; }
        }

        #endregion

        public int CompareTo(Book book)
        {
            return 0;
        }

        protected override void ValidationRules()
        {

        }

        protected override void DataUpdate()
        { }

        protected override Book DataSelect(Guid id)
        {
            return BlogService.SelectBook(id);
        }

        protected override void DataInsert()
        {
            BlogService.InsertBook(this);
        }

        protected override void DataDelete()
        {
            BlogService.DeleteBook(this);
        }

        public static List<Book> AllBook
        {
            get { return BlogService.FillBooks(); }
        }
    }
}